/*
 * Copyright (C) 2012 Tomas Shestakov. <http://code.google.com/p/jmmo/>
 */

package jmmo.engine.multifacetedactor

trait ActorSubscriber extends MultifacetedActor {

  override def receive = super.receive orElse {
    case SubscribeRequest(channel) => context.system.eventStream.subscribe(sender, channel)
    case UnsubscribeRequest(channel) => channel match {
      case null => context.system.eventStream.unsubscribe(sender)
      case _ => context.system.eventStream.unsubscribe(sender, channel)
    }
  }
}
